package org.zfes.snowier.zbss.xzy.router.message;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.zbss.xzy.biz.message.model.MessageNotify;
import org.zfes.snowier.zbss.xzy.biz.message.service.IMessageNotifyService;
import org.zfes.snowier.core.data.SelectVo;
@Controller("org.zfes.snowier.zbss.xzy.router.message.MessagePushController")
@RequestMapping("/manger/message")
public class MessagePushController implements BaseController {

	
	@Autowired
	private IMessageNotifyService messagePushService;
	
	//@RequiresPermissions(value="messagePush:loadMessagePushDataSet",desc="消息推送记录列表")
    @RequestMapping(value="/loadMessagePushDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadMessagePushDataSet(@RequestBody Map<String,Object> params){
	    DataSet dataSet=  messagePushService.loadMessagePushDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	//@RequiresPermissions(value="messagePush:createMessagePush",desc="消息推送记录添加")
    @RequestMapping(value="/createMessagePush", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public  @ResponseBody Object createMessagePush(@RequestBody MessageNotify messagePush){
		messagePushService.createMessagePush(messagePush);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	//@RequiresPermissions(value="messagePush:loadMessagePush",desc="消息推送记录加载")
    @RequestMapping(value="/loadMessagePush/{id}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadMessagePush(@PathVariable("id")Long id){
		Optional<MessageNotify> ops = messagePushService.loadMessagePushById(id);
		return ajaxQuery("messagePush",ops);
    }
	
	//@RequiresPermissions(value="messagePush:updateMessagePush",desc="消息推送记录更新")
    @RequestMapping(value="/updateMessagePush", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object updateMessagePush(@RequestBody  MessageNotify messagePush){
		messagePushService.updateMessagePush(messagePush);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	//@RequiresPermissions(value="messagePush:deletMessagePush",desc="消息推送记录删除")
    @RequestMapping(value="/deleteMessagePush/{id}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object deleteMessagePush(@PathVariable("id")Long id){
		messagePushService.deleteMessagePush(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }


    @RequestMapping(value="/loadMessagePushSelectVo", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadMessagePushSelectVo(){
		 List<SelectVo>  ops = messagePushService.loadMessagePushSelectVo("");
		return ajaxQuery("selectVo",ops);
    }
    
}